<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin:0;
            padding:0;
        }
        .box{
            width: 500px;
            height:300px;
            /* border:3px solid red; */
            display: flex;
            flex-direction: column;
            margin: auto;
        }
        ul{
            background: red;
            height:70px;
            display: flex;
            justify-content: space-around;
        }
        li{
            width:100%;
            list-style: none;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        ul li.active{
            background: yellowgreen;
        }
        ol{
            background: aqua;
            flex:1;
            position: relative;
            display: flex;
            justify-content: center;
        }
        ol>li{
            align-self: center;
            font-size: 50px;
            height:100%;
            position: absolute;
            display: none;
        }
        ol li.active{
            display: flex;
        }
    </style>
</head>
<body>
    <div class="box">
        <ul>
            <li class="active">1</li>
            <li class>2</li>
            <li class>3</li>
        </ul>
        <ol>
            <li class="active">one</li>
            <li class>two</li>
            <li class>three</li>
        </ol>
    </div>
</body>
</html>
<script>
    //利用reduce找出数组中的最大值；
    const arr = [111,1,4,7,23,56,12,1];
    const res = arr.reduce((accu,current)=>{
        return accu>current?accu:current;
    })
    console.log(res);


    //选项卡
    const ulLis = document.querySelectorAll("ul > li");
    const olLis = document.querySelectorAll("ol > li");
    ulLis.forEach((item,index)=>{
        item.addEventListener("click",e=>{
            ulLis.forEach(item=>item.className = "");
            item.className = "active";

            olLis.forEach(value=>value.classList.remove("active"));
            olLis[index].classList.add("active");
        }) 
    })



    //
</script>